home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / comm / bbs / Hydra11.lha / HBBS / Developer / CodingTips.TXT next >
Text File  |  1996-07-15  |  2KB  |  42 lines

  1. Right then, here's a couple of tips for all you door coders out there...
  2.  
  3.  
  4. 1) to make text output faster, call DOOR_WriteText() as little times as possible
  5.  
  6.   e.g. say you were writing your help for a door to the screen and you were doing
  7.   it like this...
  8.  
  9.   DOOR_WriteText("This is a cool door\r\n");
  10.   DOOR_WriteText("and here is some \r\n");
  11.   DOOR_WriteText("rather cool help text\r\n");
  12.   DOOR_WriteText("hope you like it!\r\n");
  13.  
  14.   DON'T, do it like THIS instead..
  15.  
  16.   DOOR_WriteText("This is a cool door\r\n"
  17.                  "and here is some \r\n"
  18.                  "rather cool help text\r\n"
  19.                  "hope you like it!\r\n");
  20.  
  21.   the above examples BOTH do the same thing, but the second example is better
  22.   because a) code size is smaller b) execution time is faster and c) screen
  23.   output is faster!
  24.  
  25. 2) code routines that are called lots of times in ASM...
  26.    (but comment well so you can convert it to PowerPC code next year! heh)
  27.  
  28.  
  29. 3) load your doors own private config files from "ProgDir:MyConfig.CFG" rather
  30.    than specifying an absolute path like "HBBS:Doors/MyDoor/MyConfig.CFG"
  31.  
  32.    this makes it easier for systems to move files where they like..
  33.  
  34.    (you can also get the name of the directory that your program was run from
  35.    by getting argv[0] and turning the last / into a NULL
  36.  
  37.    e.g.  argv[0]="MyHD:hbbs/doors/mydirectory/myfile.hbbs"
  38.                                              ^ change this to a 0....
  39.  
  40. 4) Have a look at the source code files HBBSCommon.c and HBBSNode.C to see
  41.    what cool library functions you can use, and ther are loads!!!
  42.